home *** CD-ROM | disk | FTP | other *** search
- Path: uunet!island!guinness.ias.edu
- From: vojta@guinness.ias.edu (Paul A Vojta)
- Newsgroups: comp.sources.x
- Subject: v05i035: xdvi, dvi previewer, patch 6, part 1/2
- Message-ID: <1230@island.uu.net>
- Date: 5 Dec 89 18:42:43 GMT
- Sender: argv@island.uu.net
- Lines: 1160
- Approved: island!argv@sun.com
-
- Submitted-by: vojta@guinness.ias.edu (Paul A Vojta)
- Posting-number: Volume 5, Issue 35
- Archive-name: xdvi/patch6
- Patch-To: xdvi: Volume 3, Issue 37-39,46,67
- Patch-To: xdvi: Volume 4, Issue 44,96
-
- Here is patch 6 for Xdvi. It incorporates a number of enhancements,
- including a more robust font searching algorithm (and note the new
- installation instructions), optional command buttons for commonly used
- commands, options to change the page size, and I fixed the bug where
- void * was tripping up some compilers.
-
- For suggestions, bugs, and fixes, I owe thanks to:
- Kevin Gates (kevin@amath.washington.edu)
- Phil Dykstra (phil@BRL.MIL)
- Paul Raveling (raveling@venera.isi.edu)
- Dan Riley (riley@tcgould.tn.cornell.edu)
- Piet Tutelaers (rcpt@eutrc4.urc.tue.nl)
-
- --Paul Vojta, vojta@guinness.ias.edu (new address)
-
- --- cut here ---
- diff -cr old/AUTHOR new/AUTHOR
- *** old/AUTHOR Fri Nov 17 21:22:49 1989
- --- new/AUTHOR Fri Nov 17 21:34:09 1989
- ***************
- *** 9,16 ****
- Jeffrey Lee, U of Toronto
- Donald Richardson, Clarkson Univ.
- At the present time, the person to send bug reports to is Paul Vojta,
- vojta@math.berkeley.edu.
- - This address will be valid at least through August, 1989.
-
- In addition to the various comp.sources.x archives, current versions of this
- program can also be obtained via anonymous ftp from the following locations:
- --- 9,16 ----
- Jeffrey Lee, U of Toronto
- Donald Richardson, Clarkson Univ.
- At the present time, the person to send bug reports to is Paul Vojta,
- + vojta@guinness.ias.edu (temporary; valid through May '90)
- vojta@math.berkeley.edu.
-
- In addition to the various comp.sources.x archives, current versions of this
- program can also be obtained via anonymous ftp from the following locations:
- diff -cr old/Imakefile new/Imakefile
- *** old/Imakefile Fri Nov 17 21:22:51 1989
- --- new/Imakefile Fri Nov 17 22:06:15 1989
- ***************
- *** 1,26 ****
- - FONT_PATH=TEXFONTS
- DEFAULT_FONT_PATH=/usr/local/tex/fonts
- FONTFORMATS_C=gf.c pk.c pxl.c
- FONTFORMATS_O=gf.o pk.o pxl.o
-
- ! DEFINES=-DMSBITFIRST \
- ! -DBMSHORT \
- ! -DFONT_PATH=\"$(FONT_PATH)\" \
- ! -DDEFAULT_FONT_PATH=\"$(DEFAULT_FONT_PATH)\"
- ! SYSLAST_LIBRARIES=-lXaw -lXmu -lXt -lX11 -lm
- SRCS=xdvi.c dvi_init.c dvi_draw.c $(FONTFORMATS_C) pxl_open.c tpic.c
- OBJS=xdvi.o dvi_init.o dvi_draw.o $(FONTFORMATS_O) pxl_open.o tpic.o
-
- ComplexProgramTarget(xdvi)
-
- ! xdvi.man:
- ! sed -e "s;%%FONT_PATH%%;$(FONT_PATH);g" \
- ! -e "s;%%DEFAULT_FONT_PATH%%;$(DEFAULT_FONT_PATH);g" \
- ! < xdvi.man.sed \
- ! > xdvi.man
-
- clean::
- ! $(RM) xdvi.man
-
- lint::
- ! lint $(INCLUDES) $(DEFINES) $(SRCS)
- --- 1,29 ----
- DEFAULT_FONT_PATH=/usr/local/tex/fonts
- + DEFAULT_FONT_SIZES=300:328.6:360:432:518.4:622:746.4
- + DEFINES=-DMSBITFIRST \
- + -DBMSHORT
- + FONTDEFINES=-DDEFAULT_FONT_PATH=\"$(DEFAULT_FONT_PATH)\" \
- + -DDEFAULT_FONT_SIZES=\"$(DEFAULT_FONT_SIZES)\"
- FONTFORMATS_C=gf.c pk.c pxl.c
- FONTFORMATS_O=gf.o pk.o pxl.o
-
- ! LOCAL_LIBRARIES=$(XAWLIB) $(XMULIB) $(XTOOLLIB) $(XLIB) -lm
- SRCS=xdvi.c dvi_init.c dvi_draw.c $(FONTFORMATS_C) pxl_open.c tpic.c
- OBJS=xdvi.o dvi_init.o dvi_draw.o $(FONTFORMATS_O) pxl_open.o tpic.o
-
- ComplexProgramTarget(xdvi)
-
- ! pxl_open.o:
- ! $(CC) -c $(CFLAGS) $(FONTDEFINES) pxl_open.c
-
- + xdvi.man: xdvi.man.sed
- + chmod u+x mksedscript
- + mksedscript $(DEFAULT_FONT_PATH) $(DEFAULT_FONT_SIZES) $(DEFINES) \
- + > sedscript
- + sed -f sedscript < xdvi.man.sed > xdvi.man
- +
- clean::
- ! $(RM) sedscript xdvi.man xdvi10.man.s
-
- lint::
- ! $(LINT) $(INCLUDES) $(DEFINES) $(FONTDEFINES) $(SRCS)
- diff -cr old/Makefile new/Makefile
- *** old/Makefile Fri Nov 17 21:22:52 1989
- --- new/Makefile Fri Nov 17 22:06:09 1989
- ***************
- *** 4,15 ****
- # $Header: Makefile,v 1.2 87/05/14 14:05:34 eichin Locked $
- # $Source: /u1/uus/vs2/xdvi/RCS/Makefile,v $
- #
- - FONT_PATH=TEXFONTS
- DEFAULT_FONT_PATH=/usr/local/tex/fonts
- DEFINES=-DMSBITFIRST \
- ! -DBMSHORT \
- ! -DFONT_PATH=\"$(FONT_PATH)\" \
- ! -DDEFAULT_FONT_PATH=\"$(DEFAULT_FONT_PATH)\"
- FONTFORMATS_C=gf.c pk.c pxl.c
- FONTFORMATS_O=gf.o pk.o pxl.o
- LIBDIR=/usr/custom/x11/lib
- --- 4,15 ----
- # $Header: Makefile,v 1.2 87/05/14 14:05:34 eichin Locked $
- # $Source: /u1/uus/vs2/xdvi/RCS/Makefile,v $
- #
- DEFAULT_FONT_PATH=/usr/local/tex/fonts
- + DEFAULT_FONT_SIZES=300:328.6:360:432:518.4:622:746.4
- DEFINES=-DMSBITFIRST \
- ! -DBMSHORT
- ! FONTDEFINES=-DDEFAULT_FONT_PATH=\"$(DEFAULT_FONT_PATH)\" \
- ! -DDEFAULT_FONT_SIZES=\"$(DEFAULT_FONT_SIZES)\"
- FONTFORMATS_C=gf.c pk.c pxl.c
- FONTFORMATS_O=gf.o pk.o pxl.o
- LIBDIR=/usr/custom/x11/lib
- ***************
- *** 18,30 ****
- #INCDIR=/tuna_a/x11r3/include
- XMULIB=
- #XMULIB=-lXmu
- ! DESTDIR=
- ! BINDIR=/usr/sipb/$$(MACHTYPE)bin
- INCLUDES=-I$(INCDIR)
- CFLAGS=-O $(INCLUDES) $(DEFINES)
- LIBS=-L$(LIBDIR) -lXaw $(XMULIB) -lXt -lX11 -lm
- ! SRCS=xdvi.c dvi_init.c dvi_draw.c $(FONTFORMATS_C) pxl_open.c tpic.c \
- ! xdvi.h dvi.h xdvi.icon
- OBJS=xdvi.o dvi_init.o dvi_draw.o $(FONTFORMATS_O) pxl_open.o tpic.o
- CC=/tuna_a/gnu/bin/gcc
- RM=rm -f
- --- 18,30 ----
- #INCDIR=/tuna_a/x11r3/include
- XMULIB=
- #XMULIB=-lXmu
- ! DESTDIR=/usr/local/x11
- ! BINDIR=$(DESTDIR)/bin
- ! MANDIR=$(DESTDIR)/man
- INCLUDES=-I$(INCDIR)
- CFLAGS=-O $(INCLUDES) $(DEFINES)
- LIBS=-L$(LIBDIR) -lXaw $(XMULIB) -lXt -lX11 -lm
- ! SRCS=xdvi.c dvi_init.c dvi_draw.c $(FONTFORMATS_C) pxl_open.c tpic.c
- OBJS=xdvi.o dvi_init.o dvi_draw.o $(FONTFORMATS_O) pxl_open.o tpic.o
- CC=/tuna_a/gnu/bin/gcc
- RM=rm -f
- ***************
- *** 45,62 ****
- pk.o: xdvi.h
- pxl.o: xdvi.h
-
- xdvi.man: xdvi.man.sed
- ! sed -e "s;%%FONT_PATH%%;$(FONT_PATH);g" \
- ! -e "s;%%DEFAULT_FONT_PATH%%;$(DEFAULT_FONT_PATH);g" \
- ! < xdvi.man.sed \
- ! > xdvi.man
-
- ! install: all
- ! install -c -s xdvi $(DESTDIR)$(BINDIR)
-
- clean:
- ! $(RM) *.o *.BAK *.CKP xdvi.man xdvi a.out core errs *~
-
- lint:
- ! lint $(INCLUDES) $(DEFINES) xdvi.c dvi_init.c dvi_draw.c \
- ! $(FONTFORMATS_C) pxl_open.c tpic.c
- --- 45,66 ----
- pk.o: xdvi.h
- pxl.o: xdvi.h
-
- + pxl_open.o:
- + $(CC) -c $(CFLAGS) $(FONTDEFINES) pxl_open.c
- +
- xdvi.man: xdvi.man.sed
- ! chmod u+x mksedscript
- ! mksedscript $(DEFAULT_FONT_PATH) $(DEFAULT_FONT_SIZES) $(DEFINES) \
- ! > sedscript
- ! sed -f sedscript < xdvi.man.sed > xdvi.man
-
- ! install: xdvi xdvi.man
- ! install -c -s -m 755 xdvi $(BINDIR)
- ! install -c -m 644 xdvi.man $(MANDIR)/man1/xdvi.1
-
- clean:
- ! $(RM) *.o *.BAK *.CKP sedscript xdvi.man xdvi a.out core errs *~
- ! $(RM) xdvi10.man.s
-
- lint:
- ! lint $(INCLUDES) $(DEFINES) $(FONTDEFINES) $(SRCS)
- diff -cr old/Makefile_10 new/Makefile_10
- *** old/Makefile_10 Fri Nov 17 21:22:53 1989
- --- new/Makefile_10 Fri Nov 17 22:06:22 1989
- ***************
- *** 4,23 ****
- # $Header: Makefile,v 1.2 87/05/14 14:05:34 eichin Locked $
- # $Source: /u1/uus/vs2/xdvi/RCS/Makefile,v $
- #
- - FONT_PATH=TEXFONTS
- DEFAULT_FONT_PATH=/usr/local/tex/fonts
- ! DEFINES=-DX10 \
- ! -DFONT_PATH=\"$(FONT_PATH)\" \
- ! -DDEFAULT_FONT_PATH=\"$(DEFAULT_FONT_PATH)\"
- FONTFORMATS_C=gf.c pk.c pxl.c
- FONTFORMATS_O=gf.o pk.o pxl.o
- ! DESTDIR=
- ! BINDIR=/usr/sipb/$$(MACHTYPE)bin
- ! INCLUDES=-I/usr/include/X
- ! CFLAGS=-O $(DEFINES)
- LIBS=-lX -lm
- ! SRCS=xdvi.c dvi_init.c dvi_draw.c $(FONTFORMATS_C) pxl_open.c tpic.c \
- ! xdvi.h dvi.h xdvi_curs.h xdvi_mask.h
- OBJS=xdvi.o dvi_init.o dvi_draw.o $(FONTFORMATS_O) pxl_open.o tpic.o
- CC=/tuna_a/gnu/bin/gcc
- RM=rm -f
- --- 4,23 ----
- # $Header: Makefile,v 1.2 87/05/14 14:05:34 eichin Locked $
- # $Source: /u1/uus/vs2/xdvi/RCS/Makefile,v $
- #
- DEFAULT_FONT_PATH=/usr/local/tex/fonts
- ! DEFAULT_FONT_SIZES=300:328.6:360:432:518.4:622:746.4
- ! DEFINES=-DX10
- ! FONTDEFINES=-DDEFAULT_FONT_PATH=\"$(DEFAULT_FONT_PATH)\" \
- ! -DDEFAULT_FONT_SIZES=\"$(DEFAULT_FONT_SIZES)\"
- FONTFORMATS_C=gf.c pk.c pxl.c
- FONTFORMATS_O=gf.o pk.o pxl.o
- ! DESTDIR=/usr/local/x10
- ! BINDIR=$(DESTDIR)/bin
- ! MANDIR=$(DESTDIR)/man
- ! #INCLUDES=-I/usr/include/X
- ! CFLAGS=-O $(INCLUDES) $(DEFINES)
- LIBS=-lX -lm
- ! SRCS=xdvi.c dvi_init.c dvi_draw.c $(FONTFORMATS_C) pxl_open.c tpic.c
- OBJS=xdvi.o dvi_init.o dvi_draw.o $(FONTFORMATS_O) pxl_open.o tpic.o
- CC=/tuna_a/gnu/bin/gcc
- RM=rm -f
- ***************
- *** 38,55 ****
- pk.o: xdvi.h
- pxl.o: xdvi.h
-
- ! xdvi.man: xdvi10.man.s
- ! sed -e "s;%%FONT_PATH%%;$(FONT_PATH);g" \
- ! -e "s;%%DEFAULT_FONT_PATH%%;$(DEFAULT_FONT_PATH);g" \
- ! < xdvi10.man.s \
- ! > xdvi.man
-
- ! install: all
- ! install -c -s xdvi $(DESTDIR)$(BINDIR)
-
- clean:
- ! $(RM) *.o *.BAK *.CKP xdvi.man xdvi a.out core errs *~
-
- lint:
- ! lint $(DEFINES) xdvi.c dvi_init.c dvi_draw.c \
- ! $(FONTFORMATS_C) pxl_open.c tpic.c
- --- 38,59 ----
- pk.o: xdvi.h
- pxl.o: xdvi.h
-
- ! pxl_open.o:
- ! $(CC) -c $(CFLAGS) $(FONTDEFINES) pxl_open.c
-
- ! xdvi.man: xdvi.man.sed
- ! chmod u+x mksedscript
- ! mksedscript $(DEFAULT_FONT_PATH) $(DEFAULT_FONT_SIZES) $(DEFINES) \
- ! > sedscript
- ! sed -f sedscript < xdvi.man.sed > xdvi.man
-
- + install: xdvi xdvi.man
- + install -c -s -m 755 xdvi $(BINDIR)
- + install -c -m 644 xdvi.man $(MANDIR)/man1/xdvi.1
- +
- clean:
- ! $(RM) *.o *.BAK *.CKP sedscript xdvi.man xdvi a.out core errs *~
- ! $(RM) xdvi10.man.s
-
- lint:
- ! lint $(INCLUDES) $(DEFINES) $(FONTDEFINES) $(SRCS)
- diff -cr old/README new/README
- *** old/README Fri Nov 17 21:22:54 1989
- --- new/README Sat Nov 4 20:34:30 1989
- ***************
- *** 1,33 ****
- ! Latest comments are at the end of the file. Add changes there.
- ! ===$Header: README,v 1.2 88/07/22 21:00:33 eichin Exp $===
- ! ================================================================
- ! This directory contains a version of xdvi capable of reading GF, PXL
- ! and PK font files. This version of xdvi is based on the source that
- ! "came with" X v10r3. Xdvi was modified by Paal Kvamme at the Norwegian
- ! Institute of Technology, based on the modifications I had made to
- ! dviimp (a dvi to ImPress converter). This code was again more or less
- ! directly translated from the web source of PKtoPX.
-
- ! If you discover (and fix) any bugs in this code, please notify me, so
- ! I can make the corresponding changes myself.
-
- ! ---------
- ! H}vard Eidnes (TeXish: H\aa vard Eidnes)
- ! Division of Computer Science
- ! Norwegian Institute of Technology
-
- ! E-Mail: h_eidnes%vax.runit.unit.uninett@nta-vax.arpa
- ! ================================================================
- ! Also has path search added by Mark Eichin, looks in TEXFONTS
- ! ================================================================
-
- - Compilation notes:
- - To compile for X10 (non athena, assumes NORMAL X10 system)
- - make -f Makefile_10
- - To compile for X11 (athena environment)
- - make
- - _Mark Eichin
- - <eichin@athena.mit.edu>
-
- The X10 flag only affects xdvi.c and pxl.c (and the flags MSBITFIRST,
- BMSHORT, and BMLONG, see below).
- --- 1,25 ----
- ! INSTALLATION INSTRUCTIONS
- !
- ! To install, do the following:
- ! 1. Read the ENVIRONMENTS section of xdvi.man.sed to determine the correct
- ! default values for the XDVIFONTS and XDVISIZES environment variables.
- ! Edit the Imakefile or Makefile and change the values of the make
- ! variables DEFAULT_FONT_PATH and DEFAULT_FONT_SIZES to these values.
-
- ! (Note: for X10 compilation, use Makefile_10 instead of Makefile.)
-
- ! You may also wish to change other compilation options; they are
- ! described later in this file.
-
- ! 2. make xdvi and try it out. If the settings in step one are incorrect,
- ! you can use the corresponding environment variables to quickly try out
- ! different values. If the values set in step 1 were incorrect,
- ! rm pxl_open.o and go back to step 1.
- !
- ! 3. make xdvi.man.
- !
- ! 4. Install xdvi and xdvi.man.
-
-
- The X10 flag only affects xdvi.c and pxl.c (and the flags MSBITFIRST,
- BMSHORT, and BMLONG, see below).
- ***************
- *** 62,70 ****
- cannot be found. Can be set to NULL. By default, it
- is "cmr10".
- NOTOOL (X11 only; xdvi.c) Compile using raw X calls.
-
- ! All flags should be set in the appropriate Makefile.
- ! ================================================================
- Additional notes:
- X11 version now works on the IBM PC/RT as well as VAX.
- [eichin:19880313.1330EST]
- --- 54,94 ----
- cannot be found. Can be set to NULL. By default, it
- is "cmr10".
- NOTOOL (X11 only; xdvi.c) Compile using raw X calls.
- + BUTTONS (xdvi.c) Put radio buttons on the right side of the
- + window for commonly used commands.
- + A4 (xdvi.c) Use European size paper by default.
-
- ! All flags should be set in the appropriate Makefile via the variable
- ! ``DEFINES''.
- !
- ! ================================================================
- !
- ! Notes of historical nature follow. Most recent changes are listed at the end
- ! of the file.
- !
- ! ================================================================
- !
- ! This directory contains a version of xdvi capable of reading GF, PXL
- ! and PK font files. This version of xdvi is based on the source that
- ! "came with" X v10r3. Xdvi was modified by Paal Kvamme at the Norwegian
- ! Institute of Technology, based on the modifications I had made to
- ! dviimp (a dvi to ImPress converter). This code was again more or less
- ! directly translated from the web source of PKtoPX.
- !
- ! If you discover (and fix) any bugs in this code, please notify me, so
- ! I can make the corresponding changes myself.
- !
- ! ---------
- ! H}vard Eidnes (TeXish: H\aa vard Eidnes)
- ! Division of Computer Science
- ! Norwegian Institute of Technology
- !
- ! E-Mail: h_eidnes%vax.runit.unit.uninett@nta-vax.arpa
- ! ================================================================
- ! Also has path search added by Mark Eichin, looks in TEXFONTS
- ! ================================================================
- !
- ! ================================================================
- Additional notes:
- X11 version now works on the IBM PC/RT as well as VAX.
- [eichin:19880313.1330EST]
- ***************
- *** 121,126 ****
- --- 145,157 ----
- generating table.h.
- -- Patchlevel 3: --
- 13. Added -altfont command line option and SYSV compilation option.
- + ================================================================================
- +
- + 4/1989 Modified for System V boxes. -DSYSV compiler option.
- +
- + Donald Richardson, donr@crystal.mie.clarkson.edu
- +
- + ================================================================================
- -- Patchlevel 4: --
- 14. Removed MAXCHARS compilation option. It's automatic now. Made X10
- scrolling smoother. Implemented the moving magnifying glass.
- ***************
- *** 132,143 ****
- a character def. were not being processed. Thanks to
- kevin@amath.washington.edu for a bug report and fix.
- 17. Added 'k' keystroke.
-
- Paul Vojta, vojta@math.berkeley.edu
- - ================================================================================
- -
- - 4/1989 Modified for System V boxes. -DSYSV compiler option.
- -
- - Donald Richardson, donr@crystal.mie.clarkson.edu
- -
- - ================================================================================
- --- 163,172 ----
- a character def. were not being processed. Thanks to
- kevin@amath.washington.edu for a bug report and fix.
- 17. Added 'k' keystroke.
- + -- Patchlevel 6: --
- + 18. Added buttons on the right side of the window.
- + 19. Added -pagewidth and -pageheight command line options and A4
- + compilation option.
- + 20. Added a yet more robust font finding algorithm.
-
- Paul Vojta, vojta@math.berkeley.edu
- diff -cr old/dvi_draw.c new/dvi_draw.c
- *** old/dvi_draw.c Fri Nov 17 21:22:57 1989
- --- new/dvi_draw.c Thu Nov 9 12:26:42 1989
- ***************
- *** 17,25 ****
- * SYSV compile for System V
- * X10 compile for X10
- * NOTOOL compile without toolkit (X11 only)
- ! * MSBITFIRST store bitmaps internally in with significant bit first
- * BMSHORT store bitmaps in shorts instead of bytes
- * BMLONG store bitmaps in longs instead of bytes
- */
-
- #include <stdio.h>
- --- 17,28 ----
- * SYSV compile for System V
- * X10 compile for X10
- * NOTOOL compile without toolkit (X11 only)
- ! * BUTTONS compile with buttons on the side of the window (needs toolkit)
- ! * MSBITFIRST store bitmaps internally with most significant bit first
- * BMSHORT store bitmaps in shorts instead of bytes
- * BMLONG store bitmaps in longs instead of bytes
- + * ALTFONT default for -altfont option
- + * A4 use European size paper
- */
-
- #include <stdio.h>
- ***************
- *** 152,161 ****
- char *fontname;
- ubyte ch;
- {
- /* width must be multiple of 16 bits for raster_op */
- bitmap->bytes_wide = ROUNDUP(bitmap->w, BITS_PER_BMUNIT) *
- BYTES_PER_BMUNIT;
- ! bitmap->bits = malloc((unsigned) bitmap->bytes_wide * bitmap->h);
- if (bitmap->bits == NULL)
- oops("Can't allocate bitmap for character %d of font %s (%d by %d)",
- ch, fontname, bitmap->w, bitmap->h);
- --- 155,167 ----
- char *fontname;
- ubyte ch;
- {
- + register unsigned int size;
- +
- /* width must be multiple of 16 bits for raster_op */
- bitmap->bytes_wide = ROUNDUP(bitmap->w, BITS_PER_BMUNIT) *
- BYTES_PER_BMUNIT;
- ! size = bitmap->bytes_wide * bitmap->h;
- ! bitmap->bits = malloc(size != 0 ? size : 1);
- if (bitmap->bits == NULL)
- oops("Can't allocate bitmap for character %d of font %s (%d by %d)",
- ch, fontname, bitmap->w, bitmap->h);
- ***************
- *** 302,317 ****
- open_pxl_file(current_font);
- Fseek(current_font->file, g->addr, 0);
- (*current_font->read_char)(current_font, ch);
- if (debug & DBG_BITMAP) print_char(ch, g);
- }
-
- if (shrink_factor == 1)
- ! put_bitmap(&g->bitmap, (PXL_H - g->x), (PXL_V - g->y));
- else {
- if (g->bitmap2.bits == NULL) {
- shrink_glyph(g);
- }
- ! put_bitmap(&g->bitmap2, (PXL_H - g->x2), (PXL_V - g->y2));
- }
- }
-
- --- 308,324 ----
- open_pxl_file(current_font);
- Fseek(current_font->file, g->addr, 0);
- (*current_font->read_char)(current_font, ch);
- + g->dvi_adv = g->dvi_adv * current_font->factor;
- if (debug & DBG_BITMAP) print_char(ch, g);
- }
-
- if (shrink_factor == 1)
- ! put_bitmap(&g->bitmap, PXL_H - g->x, PXL_V - g->y);
- else {
- if (g->bitmap2.bits == NULL) {
- shrink_glyph(g);
- }
- ! put_bitmap(&g->bitmap2, PXL_H - g->x2, PXL_V - g->y2);
- }
- }
-
- diff -cr old/dvi_init.c new/dvi_init.c
- *** old/dvi_init.c Fri Nov 17 21:22:59 1989
- --- new/dvi_init.c Sat Nov 4 18:13:36 1989
- ***************
- *** 17,25 ****
- * SYSV compile for System V
- * X10 compile for X10
- * NOTOOL compile without toolkit (X11 only)
- ! * MSBITFIRST store bitmaps internally in with significant bit first
- * BMSHORT store bitmaps in shorts instead of bytes
- * BMLONG store bitmaps in longs instead of bytes
- */
-
- #include <stdio.h>
- --- 17,28 ----
- * SYSV compile for System V
- * X10 compile for X10
- * NOTOOL compile without toolkit (X11 only)
- ! * BUTTONS compile with buttons on the side of the window (needs toolkit)
- ! * MSBITFIRST store bitmaps internally with most significant bit first
- * BMSHORT store bitmaps in shorts instead of bytes
- * BMLONG store bitmaps in longs instead of bytes
- + * ALTFONT default for -altfont option
- + * A4 use European size paper
- */
-
- #include <stdio.h>
- ***************
- *** 30,36 ****
-
- #define dvi_oops(str) longjmp(dvi_env, (int) str);
- #define XtOffset(type, field) ((unsigned int)&(((type)NULL)->field))
- - extern char *alt_font;
-
- static struct stat fstatbuf; /* mechanism to see if file was */
- time_t dvi_time; /* modified since last usage */
- --- 33,38 ----
- ***************
- *** 73,105 ****
- char *malloc(), *strcpy();
- FILE *pxl_open();
-
- - static Boolean
- - define_new_font(fontp, fontname)
- - register struct font *fontp;
- - char *fontname;
- - {
- - read_font_index_proc read_font_index;
- -
- - if (n_fonts_left == 0)
- - close_a_file();
- - fontp->file = pxl_open(font_path, fontname, fontp->size,
- - (fontp->size + 2) / 5, &fontp->filename, &read_font_index);
- - if (fontp->file == NULL) {
- - Fprintf(stderr, "Font %s at %d dpi [not found]\n", fontname,
- - (fontp->size + 2) / 5);
- - return(False);
- - }
- - (*read_font_index)(fontp);
- - --n_fonts_left;
- - return(True);
- - }
- -
- /*
- * define_font reads the rest of the fntdef command and then reads in
- * the specified pixel file, adding it to the global linked-list holding
- * all of the fonts used in the job.
- */
- ! static
- define_font(cmnd)
- ubyte cmnd;
- {
- --- 75,86 ----
- char *malloc(), *strcpy();
- FILE *pxl_open();
-
- /*
- * define_font reads the rest of the fntdef command and then reads in
- * the specified pixel file, adding it to the global linked-list holding
- * all of the fonts used in the job.
- */
- ! static void
- define_font(cmnd)
- ubyte cmnd;
- {
- ***************
- *** 108,115 ****
- struct font *fontp1;
- int len;
- int design;
- - int unmodsize;
- - float realsize;
- int size;
-
- fontp = (struct font *) malloc((unsigned) sizeof(struct font));
- --- 89,94 ----
- ***************
- *** 126,161 ****
- if(debug & DBG_PK)
- Printf("Define font \"%s\" scale=%d design=%d\n",
- fontp->fontname, fontp->scale, design);
- ! /*
- ! * In the actual implementation, scaled-size/design-size hasn't been
- ! * stored with sufficient precision, hence the messing around to find
- ! * its actual value.
- ! */
- ! realsize = (magnification/1000.)*((float) fontp->scale / design);
- ! unmodsize = (realsize * 1000) + 0.5;
- ! /* a real hack to correct for rounding in some cases */
- ! switch (unmodsize) {
- ! case 1095:
- ! realsize = 1.095445; /* stephalf */
- ! break;
- ! case 1315:
- ! realsize = 1.314534; /* stepihalf */
- ! break;
- ! case 2074:
- ! realsize = 2.0736; /* stepiv */
- ! break;
- ! case 2488:
- ! realsize = 2.48832; /* stepv */
- ! break;
- ! case 2986:
- ! realsize = 2.985984; /* stepiv */
- ! break;
- ! }
- ! /*
- ! * the remaining magnification steps are represented
- ! * with sufficient accuracy already
- ! */
- ! fontp->size = size = (realsize * pixels_per_inch * 5) + 0.5;
- fontp->scale = fontp->scale * fraction;
- /*
- * reuse font if possible
- --- 105,112 ----
- if(debug & DBG_PK)
- Printf("Define font \"%s\" scale=%d design=%d\n",
- fontp->fontname, fontp->scale, design);
- ! fontp->size = size = ((double) fontp->scale / design * magnification
- ! * pixels_per_inch * 0.005) + 0.5;
- fontp->scale = fontp->scale * fraction;
- /*
- * reuse font if possible
- ***************
- *** 163,181 ****
- for (;;) {
- fontp1 = *fontpp;
- if (fontp1 == NULL) {
- ! maxchar = 255;
- ! if (!define_new_font(fontp, fontp->fontname)) {
- ! if (alt_font == NULL || !define_new_font(fontp, alt_font)) {
- ! font_not_found = True;
- ! return;
- ! }
- Fprintf(stderr,
- ! "Can't find <%s>, using <%s> instead at %d dpi\n",
- ! fontp->fontname, alt_font, (size + 2) / 5);
- free(fontp->fontname);
- ! fontp->fontname = malloc((unsigned) strlen(alt_font)+1);
- ! (void) strcpy(fontp->fontname, alt_font);
- }
- while (maxchar > 0 && fontp->glyph[maxchar].addr == 0)
- --maxchar;
- if (maxchar < 255)
- --- 114,150 ----
- for (;;) {
- fontp1 = *fontpp;
- if (fontp1 == NULL) {
- ! read_font_index_proc read_font_index;
- ! char *font_found;
- ! int size_found;
- ! int dpi = (size + 2) / 5;
- !
- ! if (n_fonts_left == 0)
- ! close_a_file();
- ! fontp->file = pxl_open(fontp->fontname, &font_found,
- ! size, &size_found, &fontp->factor, &fontp->filename,
- ! &read_font_index);
- ! if (fontp->file == NULL) {
- ! Fprintf(stderr, "Can't find font %s.\n", fontp->fontname);
- ! font_not_found = True;
- ! return;
- ! }
- ! --n_fonts_left;
- ! if (font_found != NULL) {
- Fprintf(stderr,
- ! "Can't find font %s; using %s instead at %d dpi\n",
- ! fontp->fontname, font_found, dpi);
- free(fontp->fontname);
- ! fontp->fontname = font_found;
- }
- + else if (25 * size_found > 26 * size ||
- + 25 * size > 26 * size_found)
- + Fprintf(stderr,
- + "Can't find font %s at %d dpi; using %d dpi instead.\n",
- + fontp->fontname, dpi, (size_found + 2) / 5);
- + fontp->factor = fontp->factor * size / size_found;
- + maxchar = 255;
- + (*read_font_index)(fontp);
- while (maxchar > 0 && fontp->glyph[maxchar].addr == 0)
- --maxchar;
- if (maxchar < 255)
- diff -cr old/mksedscript new/mksedscript
- *** old/mksedscript Fri Nov 17 22:07:36 1989
- --- new/mksedscript Sat Nov 4 16:24:00 1989
- ***************
- *** 0 ****
- --- 1,25 ----
- + #! /bin/csh
- + unset x10 buttons a4
- + set noglob
- + foreach x ($argv[3-])
- + if ($x == -DX10) set x10
- + if ($x == -DBUTTONS) set buttons
- + if ($x == -DA4) set a4
- + end
- + if ($?x10) then
- + echo /^\#ifx11/,/^\#/d
- + echo s/%%dot%%//
- + else
- + echo /^\#ifx10/,/^\#/d
- + echo s/%%dot%%/./
- + endif
- + if (! $?buttons) echo /^\#ifbuttons/,/^\#/d
- + echo /^\#/d
- + if ($?a4) then
- + echo s/%%defaultpagesize%%/8.3 x 11.7 inches (A4 size)/
- + else
- + echo s/%%defaultpagesize%%/8.5 x 11 inches/
- + endif
- + echo s\;%%DEFAULT_FONT_PATH%%\;$1\;
- + echo s/%%DEFAULT_FONT_SIZES%%/$2/
- + rm -f xdvi10.man.s
- diff -cr old/patchlevel.h new/patchlevel.h
- *** old/patchlevel.h Fri Nov 17 21:23:02 1989
- --- new/patchlevel.h Wed Nov 15 20:31:44 1989
- ***************
- *** 1 ****
- ! #define PATCHLEVEL 5
- --- 1 ----
- ! #define PATCHLEVEL 6
- diff -cr old/pk.c new/pk.c
- *** old/pk.c Fri Nov 17 21:23:04 1989
- --- new/pk.c Thu Nov 9 12:28:38 1989
- ***************
- *** 240,246 ****
- putchar('\n');
- }
-
- - if (g->bitmap.w == 0) return;
- alloc_bitmap(&g->bitmap, fontp->fontname, ch);
- cp = (BMUNIT *) g->bitmap.bits;
- /*
- --- 240,245 ----
- diff -cr old/pxl_open.c new/pxl_open.c
- *** old/pxl_open.c Fri Nov 17 21:23:06 1989
- --- new/pxl_open.c Thu Nov 9 12:30:18 1989
- ***************
- *** 1,23 ****
- /*
- ! * pxl_open.c(path, font, pxlmag, pkmag, name, read_font_index)
- * Find and open gf, pk, or pxl files in the given path, having the given
- * name and magnification. It tries gf files first, followed by pk and pxl
- ! * files.. The path variable should be of the form path1:path2:...:pathn,
- * and each of the paths will be tried successively. Strings in pathi of
- * the form %f, %p, and %d will be replaced by the font name, "gf" or "pk"
- * or "pxl", and the magnification, respectively. If no %f appears in a
- ! * path specifier, then the string "/%f.%d%p" is added on the end. If
- ! * the file is found, then a file pointer is returned, and *name is set to
- ! * a string giving the file name. If the file is not found, then NULL is
- ! * returned. This procedure also returns a pointer to the glyph-reading
- ! * procedure associated with the file format.
- ! *
- * Often there are so many fonts that we need to manage the number of
- * simultaneously open files. In that case, the variable n_fonts_left
- * gives the number of open files that are left, (initially MAXINT, set
- * dynamically) and when it is necessary to close a file, these routines
- * call close_a_file() which should free up a file descriptor.
- ! *
- */
-
- #include <stdio.h>
- --- 1,35 ----
- /*
- ! * pxl_open.c(font, font_ret, mag, mag_ret, factor, name, read_font_index)
- * Find and open gf, pk, or pxl files in the given path, having the given
- * name and magnification. It tries gf files first, followed by pk and pxl
- ! * files. The path variable should be of the form path1:path2:...:pathn,
- * and each of the paths will be tried successively. Strings in pathi of
- * the form %f, %p, and %d will be replaced by the font name, "gf" or "pk"
- * or "pxl", and the magnification, respectively. If no %f appears in a
- ! * path specifier, then the string "/%f.%d%p" is added on the end. This
- ! * procedure is repeated for each of the possible magnifications allowed,
- ! * and if it fails then the procedure will try changing the point size
- ! * as well. If all of the above fails, then alt_font will be tried.
- ! *
- ! * If the file is found, then a file pointer is returned, and the following
- ! * values are set:
- ! * *font_ret a pointer to a string containing the font name (if
- ! * different from the font requested).
- ! * *mag_ret the actual magnification found.
- ! * *factor the ratio of the point sizes of the requested font
- ! * and the font actually found (or 1.0 if altfont is used).
- ! * *name a pointer to a string containing the file name
- ! * *read_font_index a pointer to the read_index procedure to be
- ! * used for the given font format.
- ! *
- ! * If the file is not found, then the return value is NULL.
- ! *
- * Often there are so many fonts that we need to manage the number of
- * simultaneously open files. In that case, the variable n_fonts_left
- * gives the number of open files that are left, (initially MAXINT, set
- * dynamically) and when it is necessary to close a file, these routines
- * call close_a_file() which should free up a file descriptor.
- ! *
- */
-
- #include <stdio.h>
- ***************
- *** 24,42 ****
- #include <string.h>
- #include <errno.h>
-
- - extern int errno;
- -
- #define PATH_SEP ':'
- #define DEFAULT_TAIL "/%f.%d%p"
-
- ! #ifndef __STDC__
- #define OPEN_MODE "r"
- ! #else __STDC__
- ! #define OPEN_MODE "rb"
- ! #endif __STDC__
-
- extern int n_fonts_left;
-
- /* the corresponding read_char procedures are handled in xdvi.h */
- typedef void (*read_font_index_proc)();
- /* struct font *fontp; */
- --- 36,56 ----
- #include <string.h>
- #include <errno.h>
-
- #define PATH_SEP ':'
- #define DEFAULT_TAIL "/%f.%d%p"
-
- ! #ifndef OPEN_MODE
- #define OPEN_MODE "r"
- ! #endif OPEN_MODE
-
- extern int n_fonts_left;
- + extern char *alt_font;
-
- + static char *font_path;
- + static char default_font_path[] = DEFAULT_FONT_PATH;
- + static int *sizes, *sizend;
- + static char default_size_list[] = DEFAULT_FONT_SIZES;
- +
- /* the corresponding read_char procedures are handled in xdvi.h */
- typedef void (*read_font_index_proc)();
- /* struct font *fontp; */
- ***************
- *** 46,61 ****
- #ifndef ANSI_LIB
- char *sprintf();
- #endif
- ! char *malloc(), *index();
-
- #define Strcpy (void) strcpy
- #define Sprintf (void) sprintf
-
- ! static FILE *formatted_open(path, font, pxl, mag, name)
- ! char *path, *font, *pxl;
- ! int mag;
- ! char **name;
- {
- char *p = path,
- nm[128],
- *n = nm,
- --- 60,136 ----
- #ifndef ANSI_LIB
- char *sprintf();
- #endif
- ! char *malloc(), *index(), *getenv();
-
- + double atof();
- +
- #define Strcpy (void) strcpy
- #define Sprintf (void) sprintf
-
- ! static void
- ! get_sizes(size_list, spp)
- ! char *size_list;
- ! int **spp;
- {
- + if (*size_list == PATH_SEP) ++size_list;
- + for (;;) {
- + *(*spp)++ = atof(size_list) * 5 + 0.5;
- + size_list = index(size_list, PATH_SEP);
- + if (size_list == NULL) return;
- + ++size_list;
- + }
- + }
- +
- + init_pxl_open()
- + {
- + char *size_list;
- + int *sp, *sp1, *sp2;
- + unsigned int n;
- + char *p;
- +
- + if ((font_path = getenv("XDVIFONTS")) == NULL)
- + font_path = default_font_path;
- + else if (*font_path == PATH_SEP)
- + /*concatenate default_font_path before font_path */
- + font_path = strcat(strcpy(malloc((unsigned)
- + strlen(default_font_path) + strlen(font_path) + 1),
- + default_font_path), font_path);
- +
- + size_list = getenv("XDVISIZES");
- + n = 1; /* count number of sizes */
- + if (size_list == NULL || *size_list == PATH_SEP)
- + for (p = default_size_list; (p = index(p, PATH_SEP)) != NULL; ++p)
- + ++n;
- + if (size_list != NULL)
- + for (p = size_list; (p = index(p, PATH_SEP)) != NULL; ++p) ++n;
- + sizes = (int *) malloc(n * sizeof(int));
- + sizend = sizes + n;
- + sp = sizes; /* get the actual sizes */
- + if (size_list == NULL || *size_list == PATH_SEP)
- + get_sizes(default_size_list, &sp);
- + if (size_list != NULL) get_sizes(size_list, &sp);
- +
- + /* bubble sort the sizes */
- + sp1 = sizend - 1; /* extent of this pass */
- + do {
- + sp2 = NULL;
- + for (sp = sizes; sp < sp1; ++sp)
- + if (*sp > sp[1]) {
- + int i = *sp;
- + *sp = sp[1];
- + sp[1] = i;
- + sp2 = sp;
- + }
- + }
- + while ((sp1 = sp2) != NULL);
- + }
- +
- + static FILE *
- + formatted_open(path, font, pxl, mag, name)
- + char *path, *font, *pxl;
- + int mag;
- + char **name;
- + {
- char *p = path,
- nm[128],
- *n = nm,
- ***************
- *** 102,137 ****
- *name = malloc((unsigned) (n - nm + 1));
- Strcpy(*name, nm);
- }
- ! return(f);
- }
-
- ! FILE *pxl_open(path, font, pxlmag, pkmag, name, read_font_index)
- ! char *path, *font;
- ! int pxlmag, pkmag;
- ! char **name;
- ! read_font_index_proc *read_font_index;
- {
- ! char *p = path;
- FILE *f;
-
- for (;;) {
- ! if (read_GF_index &&
- ! (f=formatted_open(p, font, "gf", pkmag, name)) != NULL) {
- ! *read_font_index = read_GF_index;
- ! return(f);
- }
- ! if (read_PK_index &&
- ! (f=formatted_open(p, font, "pk", pkmag, name)) != NULL) {
- ! *read_font_index = read_PK_index;
- ! return(f);
- }
- - if (read_PXL_index &&
- - (f=formatted_open(p, font, "pxl", pxlmag, name)) != NULL) {
- - *read_font_index = read_PXL_index;
- - return(f);
- - }
- - p = index(p, PATH_SEP);
- - if (p == NULL) return(NULL);
- - ++p;
- }
- }
- --- 177,284 ----
- *name = malloc((unsigned) (n - nm + 1));
- Strcpy(*name, nm);
- }
- ! return f;
- }
-
- ! static FILE *
- ! pre_pxl_open(font, mag, mag_ret, name, read_font_index)
- ! char *font;
- ! int mag, *mag_ret;
- ! char **name;
- ! read_font_index_proc *read_font_index;
- {
- ! char *p;
- FILE *f;
- + int *p1, *p2, pxlmag, pkmag;
-
- + /*
- + * Loop over sizes. Try closest sizes first.
- + */
- + for (p2 = sizes; p2 < sizend; ++p2) if (*p2 >= mag) break;
- + p1 = p2;
- for (;;) {
- ! if (p1 <= sizes)
- ! if (p2 >= sizend) return NULL;
- ! else pxlmag = *p2++;
- ! else if (p2 >= sizend || mag * mag <= p1[-1] * *p2) pxlmag = *--p1;
- ! else pxlmag = *p2++;
- ! *mag_ret = pxlmag;
- ! pkmag = (pxlmag + 2) / 5;
- ! /*
- ! * loop over paths
- ! */
- ! for (p = font_path;;) {
- ! if (read_GF_index &&
- ! (f = formatted_open(p, font, "gf", pkmag, name)) != NULL) {
- ! *read_font_index = read_GF_index;
- ! return f;
- ! }
- ! if (read_PK_index &&
- ! (f = formatted_open(p, font, "pk", pkmag, name)) != NULL) {
- ! *read_font_index = read_PK_index;
- ! return f;
- ! }
- ! if (read_PXL_index &&
- ! (f = formatted_open(p, font, "pxl", pxlmag, name)) != NULL)
- ! {
- ! *read_font_index = read_PXL_index;
- ! return f;
- ! }
- ! p = index(p, PATH_SEP);
- ! if (p == NULL) break;
- ! ++p;
- }
- ! }
- ! }
- !
- ! FILE *
- ! pxl_open(font, font_ret, mag, mag_ret, factor, name, read_font_index)
- ! char *font, **font_ret;
- ! int mag, *mag_ret;
- ! float *factor;
- ! char **name;
- ! read_font_index_proc *read_font_index;
- ! {
- ! FILE *f;
- ! int actual_pt, low_pt, high_pt, trial_pt;
- ! char fn[50], *fnend;
- !
- ! *factor = 1.0;
- ! f = pre_pxl_open(font, mag, mag_ret, name, read_font_index);
- ! if (f != NULL) {
- ! *font_ret = NULL;
- ! return f;
- ! }
- ! Strcpy(fn, font);
- ! fnend = fn + strlen(fn);
- ! while (fnend > fn && fnend[-1] >= '0' && fnend[-1] <= '9') --fnend;
- ! actual_pt = low_pt = high_pt = atoi(fnend);
- ! if (actual_pt) {
- ! low_pt = actual_pt - 1;
- ! high_pt = actual_pt + 1;
- ! for (;;) {
- ! if (2 * low_pt >= actual_pt &&
- ! (low_pt * high_pt > actual_pt * actual_pt ||
- ! high_pt > actual_pt + 5))
- ! trial_pt = low_pt--;
- ! else if (high_pt > actual_pt + 5) break;
- ! else trial_pt = high_pt++;
- ! Sprintf(fnend, "%d", trial_pt);
- ! f = pre_pxl_open(fn, mag * actual_pt / trial_pt, mag_ret, name,
- ! read_font_index);
- ! if (f != NULL) {
- ! *font_ret = strcpy(malloc((unsigned) strlen(fn) + 1), fn);
- ! *factor = (float) actual_pt / trial_pt;
- ! return f;
- ! }
- }
- }
- + if (alt_font != NULL) {
- + *font_ret = alt_font;
- + f = pre_pxl_open(alt_font, mag, mag_ret, name, read_font_index);
- + if (f != NULL)
- + *font_ret = strcpy(malloc((unsigned) strlen(alt_font) + 1),
- + alt_font);
- + }
- + return f;
- }
- diff -cr old/tpic.c new/tpic.c
- *** old/tpic.c Fri Nov 17 21:23:08 1989
- --- new/tpic.c Thu Nov 2 17:13:44 1989
- ***************
- *** 143,148 ****
- --- 143,149 ----
- dy = y1 - y0;
- if (dotted) {
- numdots = sqrt(dx*dx + dy*dy) / milliperdash + 0.5;
- + if (numdots == 0) numdots = 1;
- for (i=0; i <= numdots; i++) {
- a = (float) i / (float) numdots;
- cx0 = x0 + a*dx + 0.5;
-